package main

import (
	"api_server/internal/routers"
	"fmt"
	"net/http"
	"time"

	common "jihe.common"
)

func main() {
	//
	//_, interiorInfoBytes, errs := tool.GetRequest().Get(`https://files.dizanz.com/test_crafts/6846709645369843712.json`).Timeout(time.Second * 10).EndBytes()
	//if len(errs) != 0 {
	//
	//	return
	//}
	//interiorInfo := models.FashionCraft{}
	//if len(interiorInfoBytes) != 0 {
	//	err := json.Unmarshal(interiorInfoBytes, &interiorInfo)
	//	if err != nil {
	//
	//		return
	//	}
	//}
	//rr, _ := json.Marshal(interiorInfo.InteriorInfo["qianpian"])
	//fmt.Println(string(rr))
	//return

	srv := &http.Server{
		Addr:         fmt.Sprintf(":%d", common.Configer.Http.Port),
		Handler:      routers.Run(),
		ReadTimeout:  30 * time.Second,
		WriteTimeout: 30 * time.Second,
	}
	//log.Get().Debug("server started at %v", time.Now())
	fmt.Printf("server started at %v \n", time.Now())
	// 监听请求
	if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
		panic(err)
	}
}
